package view.drawing;

import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;

import loadsave.LoadSaveable;

/**
 * 
 * @devivation
 * Added a Dimension (mFrameSize) that holds the size of each individual
 * frame.
 * @author matt
 *
 */
public abstract class SpriteSheet implements LoadSaveable {
	
	private Image mImage;
	private boolean mIsOneShot;
	
	private Dimension mFrameSize;
	
	private int mFrameCount;
	
	private String mImagePath;
	
	
	public SpriteSheet(String path) {
		mImagePath = path;
		load();
	}
	
	private void load() {
		mImage = ImageLibrary.getInstance().getImage(mImagePath);
		mFrameSize = new Dimension(mImage.getWidth(null), mImage.getHeight(null));
	}
	
	public Image getImage() {
		return (mImage);
	}
	
	public abstract Rectangle getFrameBounds(int index);
	
	public int getFrameCount() {
		return (mFrameCount);
	}
	
	
	public boolean isOneShot() {
		return (mIsOneShot);
	}
	
	public void setOneShot(boolean isOneShot) {
		mIsOneShot = isOneShot;
	}

	public void setFrameSize(Dimension size) {
		mFrameSize = size;
	}
	
	public void setFrameSize(int width, int height) {
		if (mFrameSize == null) {
			mFrameSize = new Dimension(width, height);
		}
		else {
			mFrameSize.width = width;
			mFrameSize.height = height;
		}
	}
	
	public Dimension getFrameSize() {
		return (mFrameSize);
	}
	
	
	public int getFrameWidth() {
		return (mFrameSize.height);
	}
	
	public int getFrameHeight() {
		return (mFrameSize.width);
	}
	
	
	
}
